home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / SW Demo / Demo Source / ErrMsg.c < prev    next >
Encoding:
Text File  |  1994-10-07  |  2.6 KB  |  90 lines  |  [TEXT/MPCC]

  1. // ----------------------------------------------------------------------------------
  2. // ErrMsg.c
  3. // ----------------------------------------------------------------------------------
  4. // Deals with errors.  Right now it merely puts up an alert box with the error.
  5. //
  6. // ----------------------------------------------------------------------------------
  7. // History:
  8. //    9/26/94        Clark Goble    Original (based on a project by Brigham Stevens)
  9. //
  10.  
  11. #define KEEP_GOING 1
  12. #define DEBUGGER 2
  13. #define EXITTOSHELL 3
  14.  
  15.  
  16. void Msg(Str255 msg);
  17. void ErrMsgCode(Str255 msg, short code);
  18. void ErrMsg(Str255 msg);
  19.  
  20.  
  21. // ----------------------------------------------------------------------------------
  22. // Msg
  23. // ----------------------------------------------------------------------------------
  24. // Displays a message in an alert box.  This is a different alert window than that
  25. // used for errors.
  26.  
  27. void Msg(Str255 msg)
  28. {
  29.     ParamText(msg,nil,nil,nil);
  30.     Alert(130, nil);
  31. } // Msg
  32.  
  33. // ----------------------------------------------------------------------------------
  34. // ErrMsgCode
  35. // ----------------------------------------------------------------------------------
  36. // Displays the error alert with an error code.  This will also display memerr and
  37. // reserr for you.
  38. //
  39. // This demo is copywrite 1994 by LexTek Internation.  Feel free to use it for
  40. // whatever purpose you wish.  The SpellWright Library may not be copied or 
  41. // distributed, except when linked to your application that adds significant features
  42. // to the code.  ie. you can't take the library, make a new library and sell it.  You
  43. // can, however, use it without royalties in applications or other such projects.
  44. //
  45. // LexTek International
  46. // 2255 N. University Parkway, Suit 15
  47. // Provo, UT 84604
  48. // (801) 375.8332  Phone
  49. // (801) 375.7654  Fax 
  50.  
  51. void ErrMsgCode(Str255 msg, short code)
  52.     Str31    codeStr;
  53.     Str31    memErrStr;
  54.     Str31    resErrStr;
  55.     short    disposition;
  56.     
  57.     NumToString(code,codeStr);
  58.     NumToString(LMGetMemErr(),memErrStr);
  59.     NumToString(LMGetResErr(),resErrStr);
  60.     
  61.     ParamText(msg, codeStr, memErrStr, resErrStr);
  62.  
  63.     disposition = Alert(128, nil);
  64.     
  65.     switch(disposition)
  66.     {
  67.         case    KEEP_GOING:        return;
  68.                                 break;
  69.         case    DEBUGGER:        DebugStr("\p Doing a Stack Crawl;sc6");
  70.                                 break;
  71.         case    EXITTOSHELL:    ExitToShell();
  72.                                 break;
  73.     } // switch
  74. } // ErrMsgCode
  75.  
  76.  
  77. // ----------------------------------------------------------------------------------
  78. // ErrMsg
  79. // ----------------------------------------------------------------------------------
  80. // Displays the error alert without a code.
  81.  
  82. void ErrMsg(Str255 msg)
  83.  
  84. {
  85.     ErrMsgCode(msg, 0);
  86.     
  87. } // ErrMsg
  88.  
  89.